<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@page import="com.hahehiho.myalbum.BackupInfoStatus"%>
<%@page import="com.hahehiho.myalbum.BackupUtil"%>
<%@page import="com.hahehiho.myalbum.Util"%>
<%@page import="com.hahehiho.myalbum.RecreateInfoStatus"%>
<%@page import="com.hahehiho.myalbum.MyAlbumDB"%>
<%@page import="com.hahehiho.myalbum.Indexer"%>
<%@page import="java.io.File"%>
<%@page import="com.kt.openplatform.sdk.KTOpenApiWebHandler"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");

String path = request.getParameter("path");
String refresh = request.getParameter("refresh");
String all = request.getParameter("all");

if(path == null) {
	path = "/media/MGTEC/Picture";
}

if(refresh == null)
	refresh = "true";

KTOpenApiWebHandler ktApiHander = KTOpenApiWebHandler.createHandler("4b285725b21c1735e9e84a4f833a4a48", "baaf0b6f65127bc46d4d7e68ae0e7a74");

if(ktApiHander.isOAuthRequested()) { 
	ktApiHander.retrieveAccessToken(request); 
}

String api_id = "1.0.UCLOUD.BASIC.GETUSERINFO";
Map<String,?> params = new HashMap<String,String>();
Map<String,?> resultMap = ktApiHander.call( api_id, params, null, request, response, false );

BackupInfoStatus info = BackupUtil.getWorker();

/*
if(info == null || refresh.equalsIgnoreCase("false"))
	BackupUtil.startWorker(path, all);
*/

info = BackupUtil.getWorker();

%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,width=device-width" />
<link rel="stylesheet" href="css/default.css" >
<title>create indexing....</title>
</head>
<body>
<br>
<a href="backup.jsp?refresh=true">refresh</a> <br>
<a href="backup.jsp?refresh=false">backup only change</a> <br>
<a href="backup.jsp?refresh=false&all=true">backup all</a> <br>

</body>
</html>